import math
from libavg import avg
from trash import Trash
from config import Config

# this trash object is destroyable by doubleclicking
class DoubleclickTrash(Trash):

    def __init__(self, posi, par, weight, img):
        Trash.__init__(self, posi, par, weight, img)  # KONSTRUKTOR DER OBERKLASSE TRASH 
        self.__clicked = False # FLAG OB EINMAL ANGEKLICKT
        self.setEventHandler(avg.CURSORUP, avg.TOUCH, self._enter)

    def _enter(self, event):
        if not self.__clicked: # FALLS ANGEKLICKT
            self.__clicked = True # SETZE FLAG AUF TRUE
            if self.opacity==1:
                self.opacity=.7 # VERRINGERE SICHTBARKEI
        else:
            self.fadeOut() 